﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QD.Validate
{
    public class Validator
    {

        public static ValidateResult Check<T>(T value, params IValidateRule<T>[] rules)
        {

            ValidateResult ret = new ValidateResult();
            foreach (IValidateRule<T> rule in rules)
            {
                if (!rule.IsValidate(value))
                    ret.AddErrors(rule.Tips);

            }
            return ret;

        }


    }
}
